#include "TrackData.h"

CTrackData::CTrackData(ViewVector _views) : m_Views(_views), m_PointIndex(-1)
{

}

UINT CTrackData::GetNumViews() const
{
	return m_Views.size();
}

View CTrackData::GetView( UINT index )
{
	return m_Views[index];
}

void CTrackData::MarkPoint( int index )
{
	m_PointIndex = index;
}

bool CTrackData::IsMarked() const
{
	return (m_PointIndex >= 0);
}

bool CTrackData::IsDirty() const
{
	return (m_PointIndex == -2);
}

int CTrackData::GetMark() const
{
	return m_PointIndex;
}

SSharedView CTrackData::IsVisable(CameraIndexVector ImIndices)
{
	SSharedView RetSharedView;
	RetSharedView.pTrack = this;
	for (int j = 0; j < ImIndices.size(); j++)
	{
		for (UINT i = 0; i < GetNumViews(); i++)
		{
			View CurrView = m_Views[i];
			if (CurrView.first == ImIndices[j])
			{
				RetSharedView.views.push_back(View(j, CurrView.second));
			}
		}
	}

	return RetSharedView;
}

void CTrackData::RemoveMark()
{
	m_PointIndex = -2;
}
